package club.justwill.single.util;

import club.justwill.single.model.CoreConstants;
import club.justwill.single.model.JsonResponse;

/**
 * Created by xiangnan on 15-12-25.
 */
public class JsonResponseHelper {
    public static void addWarn(JsonResponse obj, Integer warn) {
        obj.getErrors().put(warn, CoreConstants.error.get(warn));
    }

    public static void addError(JsonResponse obj, Integer error) {
        obj.getErrors().put(error, CoreConstants.error.get(error));
    }

    public static void addInfo(JsonResponse obj, Integer info) {
        obj.getErrors().put(info, CoreConstants.error.get(info));
    }

    public static boolean isHasError(JsonResponse obj) {
        return obj.getErrors().size() > 0;
    }
}
